﻿using System.Collections.Generic;
using System.Data;
using Smarly.Core.Database;

namespace Smarly.Bussines.Membership
{
	public class SmarlyRole
	{
		public string Name { get; set; }
		public byte Weigth { get; set; }

		public static List<SmarlyRole> GetList()
		{
			return SqlRepository.ExecuteProcedureReader("User_RoleInfo_Get",
																					 new List<SpParam>{}, null,
																						(reader) =>
																						{
																							List<SmarlyRole> result = new List<SmarlyRole>();
																							while (reader.Read())
																							{
																								result.Add(new SmarlyRole
																									           {
																										           Name = reader.GetString("Name"),
																															 Weigth = reader.GetByte("Weigth"),
																									           });
																							}
																							return result;
																						});
		}
	}
}